﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Create.Master" Inherits="System.Web.Mvc.ViewPage<Langben.DAL.OfficeSpace>" %>

<%@ Import Namespace="Common" %>
<%@ Import Namespace="Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CurentPlace" runat="server">
      创建办公地点
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>
            <input class="a2 f2" type="submit" value="创建" />
            <input class="a2 f2" type="button" onclick="BackList('OfficeSpace')" value="返回" />
        </legend>
        <div class="bigdiv">
                 
            <div class="editor-label" style="display:none">
                <%: Html.LabelFor(model => model.CreateUserGuid) %>：
            </div>
            <div class="editor-field" style="display:none">
                <%: Html.EditorFor(model => model.CreateUserGuid) %>
                <%: Html.ValidationMessageFor(model => model.CreateUserGuid) %>
            </div>     
            <div class="editor-label">
                <%: Html.LabelFor(model => model.No) %>：
            </div>
            <div class="editor-field">
                <%: Html.EditorFor(model => model.No) %>
                <%: Html.ValidationMessageFor(model => model.No) %>
            </div>     
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Name) %>：
            </div>
            <div class="editor-field">
                <%: Html.EditorFor(model => model.Name) %>
                <%: Html.ValidationMessageFor(model => model.Name) %>
            </div>
        <div class="editor-label">
            <a class="anUnderLine" onclick="showModalOnly('DanWeiGuid','../../SysDepartment');">
                <%: Html.LabelFor(model => model.DanWeiGuid) %>
            </a>：
        </div>
        <div class="editor-field">
            <div id="checkDanWeiGuid">            
            </div>
            <%: Html.HiddenFor(model => model.DanWeiGuid)%>
        </div>     
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Floor) %>：
            </div>
            <div class="editor-field">
                  <%=Html.DropDownListFor(model => model.Floor,Models.SysFieldModels.GetSysField("OfficeSpace","Floor"),"请选择")%>
                <%: Html.ValidationMessageFor(model => model.Floor) %>
            </div>
        </div>
        <div class="editor-label">
            <a class="anUnderLine" onclick="myshowModalOnly('Area','FloorMap');">
                <%: Html.LabelFor(model => model.Area) %>
            </a>：
        </div>
         <div class="editor-field">
            <div id="checkArea">            
            </div>
            <%: Html.HiddenFor(model => model.Area)%>
        </div>    
    </fieldset>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    
    <script type="text/javascript">

        $(function () {
            

        });
              
        function myshowModalOnly(me, url) { //弹出窗体 ,单选

            if ($('#Floor').val() == "" || $('#Floor').val() == "请选择") {
                alert("请选择楼层。");
                return;
            }
            else if ($('#Floor').val() == "2F" ||  $('#Floor').val() == "3F" || $('#Floor').val() == "4F" || $('#Floor').val() == "5F") {
                var hidden = document.getElementById(me); //获取隐藏的控件
                if (hidden != null && hidden.value != null && hidden.value.length > 0) {
                    alert("此处为单选，请先删除已有的选项，再次尝试选择。");
                    return;
                }
                var reValue = window.showModalDialog(url + "/?floor=" + $('#Floor').val(), window, "dialogHeight:500px; dialogWidth:987px;  status:off; scroll:auto");

                if (reValue == null || reValue == "undefined" || reValue == "") {
                    return; //如果返回值为空，就返回
                }
                var index = reValue.split("^"); //分割符 ^ 的位置
                if (index[0] == null || index[0] == "undefined" || index[0].length < 1) {
                    return;
                }
                var hid = index[0].split('&'); //为隐藏控件赋值
                var view = index[1].split('&'); //显示值
                var content = ""; //需要添加到check中的内容

                if (hid != null && hid.length == 2) {
                    var i = 0;

                    if (hid[i] != "undefined" && hid[i] != "" && view[i + 1] != "undefined" && view[i + 1] != "") {

                        content += '<table  id="' + hid[i]
                        + '" class="deleteStyle"><tr><td><img src="../../../Images/deleteimge.png" title="点击删除"  alt="删除" onclick=" deleteTable('
                        + "'" + hid[i] + "'," + "'" + me + "'" + ');" /></td><td>' + view[i + 1] + '</td></tr></table>';

                        hidden.value = hid[i]; //为隐藏控件赋值
                        var c = document.getElementById("check" + me);
                        c.innerHTML += content;
                        return;
                    }
                }
                alert("请只选择一条数据。");
                return;
            }
            else if ($('#Floor').val() == "1F" || $('#Floor').val() == "6F" || $('#Floor').val() == "7F" || $('#Floor').val() == "8F") {
                alert("该楼层没有平面图，不需要操作。");
                return;
            }

            
        }
    </script>
</asp:Content>

